<script setup lang="ts">
import { Document, Timer, Share, Setting } from '@element-plus/icons-vue'
</script>

<template>
  <div class="app-container">
    <!-- 导航菜单 -->
    <el-menu
      mode="horizontal"
      router
      :default-active="$route.path"
      class="nav-menu"
    >
      <el-menu-item index="/">
        <el-icon><Document /></el-icon>
        <span>剪贴板</span>
      </el-menu-item>
      <el-menu-item index="/history">
        <el-icon><Timer /></el-icon>
        <span>历史记录</span>
      </el-menu-item>
      <el-menu-item index="/shared">
        <el-icon><Share /></el-icon>
        <span>共享内容</span>
      </el-menu-item>
      <el-menu-item index="/settings">
        <el-icon><Setting /></el-icon>
        <span>设置</span>
      </el-menu-item>
    </el-menu>

    <!-- 路由视图 -->
    <router-view v-slot="{ Component }">
      <transition name="fade" mode="out-in">
        <component :is="Component" />
      </transition>
    </router-view>
  </div>
</template>

<style scoped>
.app-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.nav-menu {
  border-bottom: 1px solid var(--el-border-color-light);
}

.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}

.logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;
}

.logo:hover {
  filter: drop-shadow(0 0 2em #646cffaa);
}

.logo.vue:hover {
  filter: drop-shadow(0 0 2em #42b883aa);
}
</style>
